package com.example.ISearchBlog.common;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/*
* 统一异常的处理和返回
* */
@RestControllerAdvice
public class MyExceptionAdvice {

    @ExceptionHandler(Exception.class)
    public AjaxResult doException(Exception e) {
        return AjaxResult.fail(-1, e.getMessage());
    }

}
